-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Var.split_by_season #79
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #79 +/- ##
==========================================
+ Coverage 96.37% 96.55% +0.18%
==========================================
Files 10 10
Lines 607 639 +32
==========================================
+ Hits 585 617 +32
Misses 22 22 ☔ View full report in Codecov by Sentry. |
NEWS.md
Outdated
### Split by season | ||
`OutputVar`s can be split by seasons using `split_by_season(var)` provided that a start date | ||
can be found in `var.attributes["start_date"]` and time is a dimension in the `OutputVar`. | ||
The unit of time is expected to be seconds. The function `split_by_season(var)` return a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unit of time is expected to be seconds. The function `split_by_season(var)` return a | |
The unit of time is expected to be seconds. The function `split_by_season(var)` returns a |
docs/src/var.md
Outdated
## Split by season | ||
`OutputVar`s can be split by seasons using `split_by_season(var)` provided that a start date | ||
can be found in `var.attributes["start_date"]` and time is a dimension in the `OutputVar`. | ||
The unit of time is expected to be seconds. The function `split_by_season(var)` return a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unit of time is expected to be seconds. The function `split_by_season(var)` return a | |
The unit of time is expected to be seconds. The function `split_by_season(var)` returns a |
src/Var.jl
Outdated
error("Start date is not found in var") | ||
|
||
season_dates = | ||
split_by_season(time_to_date.(start_date, var.dims[time_name(var)])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split_by_season(time_to_date.(start_date, var.dims[time_name(var)])) | |
split_by_season(time_to_date.(start_date, times(var))) |
src/Var.jl
Outdated
season_data = ( | ||
_data_at_dim_vals( | ||
var.data, | ||
var.dims[time_name(var)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var.dims[time_name(var)], | |
times(var), |
9b3c473
to
313225b
Compare
Also, add Utils.period_to_seconds_float. These functions are functionally identical to the equivalent functions in ClimaUtilities. We do not export from ClimaUtilities because we do not want to add ClimaUtilities as a dependency.
We do this because we want to show the documentation for Var.split_by_season and not Utils.split_by_season.
Bug introduced: The documentation show the wrong module name for Var.split_by_season. It is ClimaAnalysis.Utils.split_by_season instead of ClimaAnalysis.Var.split_by_season.
313225b
to
c9c0eec
Compare
Close #78 - This PR implement split_by_season for
OutputVar
s. It return four OutputVars with each one corresponding to a season. This PR also add functions for converting from date to time and time to date (Utils.time_to_date, Utils.date_to_time, Utils.period_to_seconds_float).This PR add a bug to the documentation which cause the documentation for
Var.split_by_season
to beClimaAnalysis.Utils.split_by_season
instead ofClimaAnalysis.Var.split_by_season
.